import 'package:freedom/page/mahjong/common/mahjong_context.dart';
import 'package:freedom/page/mahjong/common/message_content.dart';
import 'package:freedom/page/mahjong/event/user_cell_event.dart';
import 'package:freedom/page/mahjong/message/abstract_action_message.dart';
import 'package:freedom/util/voice_message_sound.dart';

class CallAction extends AbstractMessageActionHandler<MahjongMessage> {
  @override
  void doMessage(MahjongMessage message) {
    var userDiskInfo = MahjongContext.getUserStateById(message.exeActionUid);
    if (userDiskInfo == null) {
      return;
    }
    // 当下发碰的时候  直接播放声音
    VoiceMessageSound().play("TING", close: () {});
    MahjongContext.mahjongGameIndex.addBBTH('ting', userDiskInfo.direction);
    MahjongContext.postUserEvent<UserCellEvent>(
        message.exeActionUid, UserCellEvent());
  }
}
